Reject abandoned branch hashes - #14
Open
Frozen wants to merge 1 commit into
Open
Conversation
Greptile SummaryThe PR introduces a centralized exact-hash denylist for three abandoned or malicious blocks and applies it across consensus validation, header and crosslink verification, block insertion, epoch synchronization, receipt-chain processing, head updates, TiKV forwarding, and off-chain persistence.
Confidence Score: 5/5The PR appears safe to merge; the denylist is consistently enforced before the relevant consensus acceptance and persistence boundaries. The changed paths reject direct and embedded denied hashes before caching, signature acceptance, canonical-head updates, or database writes, and no reachable bypass or regression remains.
|
| Filename | Overview |
|---|---|
| consensus/engine/rejected_block.go | Defines the shared rejection error, exact denylist, and hash-validation helper. |
| consensus/validator.go | Enforces rejection before FBFT logging, PREPARE signing, and verified-block cache shortcuts. |
| core/rejected_block.go | Extends rejection to block hashes, decoded crosslinks, and incoming receipt source headers. |
| internal/chain/engine.go | Rejects denied headers and crosslinks before signature verification or signature-cache use. |
| core/blockchain_impl.go | Adds rejection gates to receipt import, block writes, head changes, TiKV forwarding, and chain insertion. |
| core/epochchain.go | Prevents denied blocks from entering epoch-chain insertion and head-update paths. |
| core/offchain.go | Prevents off-chain receipt and crosslink writes for blocks containing denied references. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Incoming block or FBFT message] --> B{Exact block hash denied?}
B -- Yes --> X[Return ErrRejectedBlock]
B -- No --> C{Embedded crosslink hash denied?}
C -- Yes --> X
C -- No --> D{Incoming receipt source hash denied?}
D -- Yes --> X
D -- No --> E[Continue signature and semantic validation]
E --> F[Consensus cache or persistence paths]
Reviews (1): Last reviewed commit: "fix: reject abandoned branch hashes" | Re-trigger Greptile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
92,730,035by exact hash92,730,036and shard 1 block94,978,279rejected by exact hashThis copies only the abandoned-branch rejection from #13. PR #13 itself is unchanged.
[Test]
gofmtandgoimportson changed Go filesgo test -mod=readonly ./consensus/engine ./internal/chain ./consensus ./corego vet -mod=readonly ./consensus/engine ./internal/chain ./consensus ./coregit diff --check